package com.supermarket.api.repository;

import com.supermarket.api.entity.CollectionEntity;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 用户收藏相关
 * @author 李其伟
 * @date 2023/11/10
 */
@Repository
public interface CollectionRepository extends JpaRepository<CollectionEntity, Long> {

    List<CollectionEntity> findAllByUserId(Long userId);

    List<CollectionEntity> findAllByUserIdAndSku(Long userId, String sku);

    Page<CollectionEntity> findAllByUserId(Long userId, Pageable pageable);
}
